package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.cnswhy.cloud.server.common.entity.enumeration.TransType;
import com.cnswhy.cloud.server.common.entity.enumeration.WalletType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-14
 */

@ToString(callSuper = true)
@ApiModel(value = "CustomerWalletTransExcelDtl", description = "")
public class CustomerWalletTransExcelDtl{
    private static final long serialVersionUID = 1911140099236341178L;
    /**
     * 客户ID
     */
    @ApiModelProperty(value = "登录账号")
    @NotNull(message = "登录账号不能为空")
    @TableField("login_name")
    @Excel(name = "登录账号")
    @Getter
    @Setter
    private Long loginName;
    /**
     * 钱包类型
     */
    @ApiModelProperty(value = "钱包类型")
    @NotNull(message = "钱包类型")
    @TableField("wallet_type")
    @Excel(name = "钱包类型", replace = {"余额_BALANCE", "拼购券_COUPON",
            "拼购券总计_TOTAL_COUPON", "拼团值_SPELL_VALUE", "贡献值_CONTRIBUTION_VALUE",
            "拼团收益_SPELL_BALANCE", "拼团收益_CONTRIBUTION_BALANCE",
            "爱心收益_LOVE_BALANCE", "分享收益_SHARE_BALANCE",
            "队长值_TEAM_VALUE",
            "队长分红_TEAM_BALANCE",
            "消费值_CONSUME_VALUE",
            "消费分红_CONSUME_BALANCE",
            "红利分润_SPLIT_BALANCE",
            "小队红包_SMALL_BALANCE",
            "_null"})
    @Setter
    private WalletType walletType;
    private String getWalletType(){
        return walletType.getDesc();
    }
    /**
     * 可用余额
     */
    @ApiModelProperty(value = "可用余额")
    @NotNull(message = "可用余额不能为空")
    @TableField("avlb_balance")
    @Getter
    @Excel(name = "可用余额")
    private Long avlbBalance;
    public String getAvlbBalance(){
        return String.format("%.2f",avlbBalance.doubleValue() / 100);
    }

    /**
     * 客户ID
     */
    @ApiModelProperty(value = "客户ID")
    @NotNull(message = "客户ID不能为空")
    @TableField("customer_wallet_id")
    @Excel(name = "")
    @Getter
    @Setter
    private Long customerWalletId;

    /**
     * 钱包类型 #TransType{WITHDRAW:提现;CHARGE:充值;}
     */
    @ApiModelProperty(value = "钱包类型 #TransType{WITHDRAW:提现;CHARGE:充值;}")
    @NotNull(message = "钱包类型 #TransType{WITHDRAW:提现;CHARGE:充值;}不能为空")
    @TableField("trans_type")
    @Excel(name = "交易类型", replace = {"提现_WITHDRAW",
            "充值_CHARGE", "分享充值_SHARE_CHARGE",
            "分享转账_SHARE_TRANSFER", "拼购券充值_COUPON_CHARGE",
            "拼购券转账_COUPON_TRANSFER", "拼团收益_SPELL_BALANCE_CHARGE",
            "拼团值收益_SPELL_VALUE_CHARGE", "拼团收益转账_SPELL_BALANCE_TRANSFER",
            "贡献收益充值_CONTRIBUTION_BALANCE_CHARGE", "贡献收益转账_CONTRIBUTION_BALANCE_TRANSFER",
            "队长分红_TEAM_BALANCE_CHARGE", "队长分红转账_TEAM_BALANCE_TRANSFER",
            "贡献收益_CONTRIBUTION", "爱心收益转账_LOVE_BALANCE_TRANSFER",
            "爱心收益充值_LOVE_BALANCE_CHARGE", "爱心收益回收_LOVE_BALANCE_RECYCLE",
            "平台回购充值_BACK_ORDER_CHARGE", "拼团_SPELL_ORDER", "商城购买_SHOP_ORDER",
            "拼团失败_SPELL_ORDER_FAILURE","分润_SPLIT","回收_RECYCLE",
            "拼团_SPELL_ORDER","平台回购充值_BACK_ORDER_CHARGE",
            "消费分红_CONSUME_BALANCE_CHARGE",  "_null"})
    @Getter
    @Setter
    private TransType transType;
    private String getTransType(){
        return transType.getDesc();
    }
    /**
     * 交易系统订单号
     */
    @ApiModelProperty(value = "交易系统订单号")
    @NotEmpty(message = "交易系统订单号不能为空")
    @Length(max = 32, message = "交易系统订单号长度不能超过32")
    @TableField(value = "trans_order_id", condition = LIKE)
    @Excel(name = "交易系统订单号")
    @Getter
    @Setter
    private String transOrderId;

    /**
     * 期初余额
     */
    @ApiModelProperty(value = "期初余额")
    @NotNull(message = "期初余额不能为空")
    @TableField("begin_bal")
    @Excel(name = "期初余额")
    @Setter
    private Long beginBal;
    public String getBeginBal(){
        return String.format("%.2f",beginBal.doubleValue() / 100);
    }
    /**
     * 变动金额
     */
    @ApiModelProperty(value = "变动金额")
    @NotNull(message = "变动金额不能为空")
    @TableField("ded_bal")
    @Excel(name = "变动金额")
    @Setter
    private Long dedBal;
    public String getDedBal(){
        return String.format("%.2f",dedBal.doubleValue() / 100);
    }
    /**
     * 期末余额
     */
    @ApiModelProperty(value = "期末余额")
    @NotNull(message = "期末余额不能为空")
    @TableField("end_bal")
    @Setter
    @Excel(name = "期末余额")
    private Long endBal;
    public String getEndBal(){
        return String.format("%.2f",endBal.doubleValue() / 100);
    }
    /**
     * 清算日期
     */
    @ApiModelProperty(value = "清算日期")
    @TableField(value = "sett_date", condition = LIKE)
    @Excel(name = "清算日期")
    @Getter
    @Setter
    private String settDate;

    @ApiModelProperty(value = "拼团订单")
    @TableField(value = "spell_order_id", condition = LIKE)
    @Excel(name = "拼团订单")
    @Getter
    @Setter
    private String spellOrderId;

    @ApiModelProperty(value = "拼团人账号")
    @TableField(value = "split_from", condition = LIKE)
    @Excel(name = "拼团人账号")
    @Getter
    @Setter
    private String splitFrom;
    @ApiModelProperty(value = "分润级别")
    @TableField(value = "split_level")
    @Excel(name = "分润级别")
    @Getter
    @Setter
    private Integer splitLevel;
    /**
     * 客户ID
     */
    @ApiModelProperty(value = "客户ID")
    @NotNull(message = "客户ID不能为空")
    @TableField("customer_id")
    @Excel(name = "")
    @Getter
    @Setter
    private Long customerId;


    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time")
    @Excel(name = "创建时间")
    @Getter
    @Setter
    protected LocalDateTime createTime;
    @ApiModelProperty(value = "最后修改时间")
    @TableField(value = "update_time")
    @Getter
    @Setter
    protected LocalDateTime updateTime;

}
